package com.hopu.oa.service.impl.UserManageControllerImpl;

import com.hopu.oa.dao.UserManage.OnlineUserManageDao;
import com.hopu.oa.entity.user.AoaPosition;
import com.hopu.oa.service.UserManageService.OnlineUserManageService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OnlineUserManageServiceImp implements OnlineUserManageService {

    @Resource
    private OnlineUserManageDao aoaPositionDao;

    @Override
    public List<AoaPosition> queryAllByPosition(@Param("aoaPosition") AoaPosition aoaPosition, @Param("idnex") Integer index, @Param("size") Integer size) {
        return aoaPositionDao.queryAllByPosition(aoaPosition, index, size);
    }

    @Override
    public AoaPosition selectById(Integer positionId) {
        AoaPosition aoaPosition = aoaPositionDao.selectById(positionId);
        return aoaPosition;
    }

    @Override
    public AoaPosition selectByName(String name) {
        AoaPosition aoaPosition = aoaPositionDao.selectByName(name);
        return aoaPosition;

    }

    @Override
    public int delete(Integer positionId) {
        int delete = aoaPositionDao.delete(positionId);
        return delete;
    }

    /**
     * 通过ID查询单条数据
     *
     * @param positionId 主键
     * @return 实例对象
     */
    @Override
    public AoaPosition queryById(Integer positionId) {
        return this.aoaPositionDao.queryById(positionId);
    }


    /**
     * 新增数据
     *
     * @param aoaPosition 实例对象
     * @return 实例对象
     */
    @Override
    public AoaPosition insert(AoaPosition aoaPosition) {
        this.aoaPositionDao.insert(aoaPosition);
        return aoaPosition;
    }

    /**
     * 修改数据
     *
     * @param aoaPosition 实例对象
     * @return 实例对象
     */
    @Override
    public AoaPosition update(AoaPosition aoaPosition) {
        this.aoaPositionDao.update(aoaPosition);
        return this.queryById(aoaPosition.getPositionId());
    }


}
